<?php

class b2c_mdl_goods_type_props extends dbeav_model{
    var $has_many = array(
        'props_value' => 'goods_type_props_value:contrast'
    );

    const TTL = 7200;//缓存时间
    const REDIS_DB = 1;

    function get_props_id_by_type_id_and_goods_p($type_id,$goods_p){
        $redis = kernel::single('base_kvstore_redis2');
        $redis->selects(self::REDIS_DB);
        $key = 'b2c_mdl_goods_type_props:'.$goods_p.':'.$type_id;
        if($redis->exists($key)){
            return unserialize($redis->get($key));
        }else{
            $data = $this->getList('props_id', array('type_id' => $type_id, 'goods_p' => $goods_p));
            $redis->set($key,serialize($data));
            $redis->expire($key,self::TTL);
            return  $data;
        }
    }

}
